
//
//  DescribeCell.m
//  New_Runway
//
//  Created by mack on 2018/1/29.
//  Copyright © 2018年 NelsonJ. All rights reserved.
//

#import "DescribeCell.h"

@interface DescribeCell ()<UITextViewDelegate>

@end

@implementation DescribeCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self addAllViews];
        self.contentView.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (void)addAllViews
{
    _textview = [[UITextView alloc] init];
    _textview.delegate = self;
    _textview.font = [UIFont systemFontOfSize:13];
    _textview.textColor = kColorLightGray();
    [self.contentView addSubview:_textview];
    _textview.tintColor = MAIN_NAV_COLOR();
    _textview.text = @"请输入特卖描述";
    kSelfWeak;
    
    [_textview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(weakSelf.contentView).mas_offset(15);
        make.right.bottom.equalTo(weakSelf.contentView).mas_offset(-15);
    
    }];
    
    
}
- (void)textViewDidEndEditing:(UITextView *)textView
{
    if(textView.text.length < 1){
        textView.text = @"请输入特卖描述";
        textView.textColor = kColorLightGray();
    }
    kSelfWeak;
    if (weakSelf.returnValueBlock) {
        //将自己的值传出去，完成传值
        weakSelf.returnValueBlock(textView.text);
    }

}
- (void)textViewDidBeginEditing:(UITextView *)textView
{
    if([textView.text isEqualToString:@"请输入特卖描述"]){
        textView.text=@"";
        textView.textColor= MAIN_FONT_COLOR();
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
